import { fetchHome } from '../../services/home/home';
Page({
  data: {
    list: [{
      title: '组织加入',
      imgSrc: '/image/home/ic_jiaru.png',
      subTit: '提交申请',
      src: ''
    },
    {
      title: '成为志愿者',
      imgSrc: '/image/home/zhiyuanzhe.png',
      subTit: '立即注册',
      src: ''
    }],
    current: 1,
    autoplay: true,
    duration: '500',
    interval: 5000,
    navigation: { type: 'dots' },
    swiperImageProps: { mode: 'scaleToFill' },
    imgSrcs: [],
    // 步骤条
    third: 2,
    isFixed: false, //固定时搜索框背景为白色 加一个过度效果 到时候 
    timeList: [
      { time: '2023-3-7', cont: '三八妇女节送花活动.', img: '/image/home/h_a1.jpg', count: 25 },
      { time: '2023-3-2', cont: '校本课程资源更新啦！', img: '/image/home/h_a2.jpg', count: 40 },
      { time: '2023-2-27', cont: '更多专家入驻！ 快来交流吧！', img: '/image/home/h_a3.jpg', count: 11 },
      { time: '2023-2-19', cont: '开学第一课！', img: '/image/home/h_a4.jpg', count: 18 },
    ]
  },
  onShow() {
    this.init();
  },
  init() {
    this.loadHomePage();
  },
  goodListPagination: {
    index: 0,
    num: 20,
  },
  loadHomePage() {
    fetchHome().then(({ swiper, tabList }) => {
      console.log(swiper);
      this.setData({
        imgSrcs: swiper,
        // nav: tabList
      });
    });
  },
  imageDetail() {
    console.log('点击了轮播图')
  },

  scroll(e) {
    // console.log(e.detail);
    let { isFixed } = e.detail
    this.setData({ isFixed })
  }
})